Page({

  data: {
      unknownWords: [] // 复习的词汇
  },

  onLoad: function (options) {
      // 从存储中获取需要复习的词汇
      let unknownWords = wx.getStorageSync('unknownWords') || [];
      this.setData({
          unknownWords: unknownWords
      });
  },

  markMastered: function (e) {
      // 从 unknownWords 中移除已掌握的单词
      let index = e.currentTarget.dataset.index;
      let updatedUnknownWords = this.data.unknownWords;
      updatedUnknownWords.splice(index, 1);
      this.setData({
          unknownWords: updatedUnknownWords
      });

      // 如果所有单词都标记为已掌握，返回到单词学习页面
      if (updatedUnknownWords.length === 0) {
          wx.navigateTo({
              url: '/packageE/pages/word/word' // 跳转回单词学习页面
          });
      }
  }
});
